<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:rich="http://richfaces.ajax4jsf.org/rich"
	xmlns:ctg="http://www.crotouristguide.com/taglib"
	xmlns:a="https://ajax4jsf.dev.java.net/ajax">

<ui:component>
	<a:region renderRegionOnly="true">
		<fieldset>
			<legend>#{messages['label.event.desc']}</legend>
		<s:decorate id="jezikDecoration"
			template="/templates/edit.xhtml"> 
			<ui:define name="label">#{messages['label.language']}</ui:define>
			<h:selectOneMenu value="#{dogadjajAction.opis.jezik}" required="true"
				styleClass="field">
				<s:selectItems var="j" value="#{dogadjajAction.dostupniJezici}"
					label="#{messages[stringUtil.merge('label.jezik.',j.idJezika)]}"
					noSelectionLabel="#{messages['label.suggest.selectvalue']}" />

				<s:convertEntity />
			</h:selectOneMenu>
		</s:decorate> <s:decorate id="nazivDecoration" template="/templates/edit.xhtml">
			<ui:define name="label">#{messages['label.name']}</ui:define>
			<h:inputText value="#{dogadjajAction.opis.naziv}" required="true"
				styleClass="field f450">
			</h:inputText>
		</s:decorate> <s:decorate id="opisDecoration" template="/templates/edit.xhtml">
			<ui:define name="label">#{messages['label.desc']}</ui:define>
			<h:inputTextarea value="#{dogadjajAction.opis.opis}"
				styleClass="text t450" required="true">
			</h:inputTextarea>
		</s:decorate> <a:commandButton value="#{messages['label.add']}"
			action="#{dogadjajAction.addOpis}"
			reRender="jezikDecoration,nazivDecoration,opisDecoration,opisi">
		</a:commandButton> <h:dataTable id="opisi" value="#{opisi}" var="o">
			<h:column title="#{messages['label.jezik']}">
				<h:outputText
					value="#{messages[stringUtil.merge('label.jezik.',o.jezik.idJezika)]}" />
			</h:column>
			<h:column title="#{messages['label.opis']}">
				<b><h:outputText value="#{o.naziv}" /></b>
				<br />
				<h:outputText value="#{o.opis}" />
			</h:column>
		</h:dataTable></fieldset>
	</a:region>
	<a:region renderRegionOnly="true">
		<s:decorate id="datumOdDecoration" template="/templates/edit.xhtml">
			<ui:define name="label">#{messages['label.datum.od']}</ui:define>
			<rich:calendar value="#{dogadjaj.datumOd}" styleClass="field"
				popup="true" showApplyButton="true" datePattern="dd.MM.yyyy HH:mm"
				required="true" />
		</s:decorate>
		<s:decorate id="trajanjeDecoration" template="/templates/edit.xhtml">
			<ui:define name="label">#{messages['label.trajanje']}</ui:define>
			<a:region>
				<h:selectBooleanCheckbox value="#{dogadjaj.trajanje}">
					<a:support event="onchange"></a:support>
				</h:selectBooleanCheckbox>
			</a:region>
		</s:decorate>
		<a:outputPanel ajaxRendered="true">
			<s:decorate id="datumDoDecoration" template="/templates/edit.xhtml"
				rendered="#{dogadjaj.trajanje == true}">
				<ui:define name="label">#{messages['label.datum.do']}</ui:define>
				<rich:calendar value="#{dogadjaj.datumDo}" styleClass="field"
					popup="true" showApplyButton="true" datePattern="dd.MM.yyyy HH:mm" />
			</s:decorate>
		</a:outputPanel>
		<s:decorate id="wwwDecoration" template="/templates/edit.xhtml">
			<ui:define name="label">#{messages['label.www']}</ui:define>
			<h:inputText styleClass="field f450" value="#{dogadjaj.www}" />
		</s:decorate>

		<br />
		<div class="navPanel" style="width: 100%;"><a:commandButton
			id="submit" reRender="datumOdDecoration" action="next"
			value="#{messages['label.input.next']}" /> <a:commandButton
			action="#{dogadjajAction.cancel}" value="#{messages['label.cancel']}"
			immediate="true">
		</a:commandButton></div>
	</a:region>
</ui:component>

</html>